package com.annotation.entities;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class Dog {

    public Dog() {
        System.out.println("Dog's Constructor...");
    }

    /**
     *  指定组建的init方法和destroy的几种方法
     *      1：在配置类中 @Bean(initMethod = "init",destroyMethod = "destory")注解指定
     *      2：实现InitializingBean重写其afterPropertiesSet方法，重写DisposableBean重写destroy方法
     *      3：利用java的JSR250规范中的@PostConstruct标注在init方法上，@PreDestroy标注在destroy注解上
     */

    @PostConstruct
    public void init(){
        System.out.println("Dog's Init...");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("Dog's Destroy");
    }

}
